<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <h2>建议售货机</h2>
        <button @click="fn(10)">啤酒10元</button>
        <button @click="fn(5)">雪碧5元</button>
        <p>剩余钱数: {{ money }}元</p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                money: 1000,
            },
            methods: {
                fn(price) {
                    this.money -= price
                }
            }
        })
    </script>

</body>

</html>